<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
    <style>
        #content {
            width: 100%;
        }
        #content input {
            width: 200px;
            margin-bottom: 20px;
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script>
        $(document).ready(function () {
            $("#initData").on('click', function () {
                if($("#initData").prop('checked')){
                    $("#initData").val("1");
                }else{
                    $("#initData").val("0");
                }
            })

            $('.btn').on('click', function () {
                var tenantId = $('.inp-one').val();
                var sysId = $('.inp-two').val();
                var startDate = $('.inp-three').val();
                var endDate = $('.inp-four').val();
                var initFlag = $('.inp-five').val();
                var paramJson = {
                    resCode: sysId
                };
                paramJson.tenantId = tenantId;
                $.ajax({
                    url: '/rest/productActive/activePersonal',
                    method: 'post',
                    contentType: 'application/json',
                    data:  JSON.stringify({
                        startDate: startDate,
                        endDate: endDate,
                        initData: initFlag,
                        userObject: JSON.stringify(paramJson)
                    }),
                    success: function (data) {
                        if(data.success){
                            alert('开通成功！');
                        }else{
                            alert('开通失败！');
                        }
                    }
                })
            })
        })
    </script>
</head>
<body>

    <div id="content">
        <span>tenantId:</span>
        <input type="text" class="form-control inp-one"/>
        <span>sysId:</span>
        <input type="text" class="form-control inp-two"/>
        <span>startDate:</span>
        <input type="text" class="form-control inp-three" placeholder="YYYY-MM-DD HH:mm:ss"/>
        <span>endDate:</span>
        <input type="text" class="form-control inp-four" placeholder="YYYY-MM-DD HH:mm:ss"/>
        <label name="initData">initData</label>
        <input name="initData" type="checkbox" id="initData" class="inp-five" value="0"/>
        <button class="btn btn-default" type="submit" style="display: block">提交</button>
    </div>
</body>
</html>